package com.yonyou.service.demo.util;

import com.yonyou.service.demo.Consts;

import java.util.List;

public class RestResult {
    private int code;
    private int pageSize;
    private int total;
    private String message;
    private List<Object> data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<Object> getData() {
        return data;
    }

    public void setData(List<Object> data) {
        this.data = data;
    }

    public static RestResult errorResult(String message) {
        RestResult result = new RestResult();
        result.setCode(Consts.ERROR_REST_CODE);
        result.setMessage(message);
        return result;
    }

    public static RestResult successResult(String message) {
        RestResult result = new RestResult();
        result.setCode(Consts.SUCCESS_REST_CODE);
        result.setMessage(message);
        return result;
    }
}
